<%--
  Created by IntelliJ IDEA.
  User: 86166
  Date: 2024/08/17
  Time: 20:42
  To change this template use File | Settings | File Templates.
    融资详情页面
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>融资管理系统</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="assets/css/amazeui.min.css"/>
    <link rel="stylesheet" href="assets/css/admin.css">
    <link rel="stylesheet" href="assets/css/app.css">
    <script type="text/javascript" src="assets/js/jquery-1.8.3.js"></script>
    <script type="text/javascript">
        var no = '<%=request.getParameter("no")%>';
        var eid = '<%=request.getParameter("eid")%>';
        var name =  '<%=request.getParameter("name")%>';
        var bank;
        var val;
        var num;
        alert(no + "    " + eid);

        $(document).ready(function () {
            $("#name").text(name);
            $.get("FMS/queryInstituties",{"no":no},function (List) {
                eval("var obj="+List);
                $("<tr>" +
                    "<td>" + obj.vou[0].open_enterprise_name + "</td>" +
                    // 添加其他需要的列
                    "</tr>").appendTo("div[id='1']");

                $("<tr>" +
                    "<td>" + obj.vou[0].social_uniform_code + "</td>" +
                    // 添加其他需要的列
                    "</tr>").appendTo("div[id='2']");

                $("<tr>" +
                    "<td>" + obj.vou[0].instituty_name + "</td>" +
                    // 添加其他需要的列
                    "</tr>").appendTo("div[id='3']");

                $("<tr>" +
                    "<td >" + obj.vou[0].amount + "元" + "</td>" +
                    // 添加其他需要的列
                    "</tr>").appendTo("div[id='4']");

                $("<tr>" +
                    "<td>" + obj.vou[0].open_time + "</td>" +
                    // 添加其他需要的列
                    "</tr>").appendTo("div[id='5']");

                $("<tr>" +
                    "<td>" + obj.vou[0].expiry_time + "</td>" +
                    // 添加其他需要的列
                    "</tr>").appendTo("div[id='6']");

                $("<tr>" +
                    "<td>" + obj.vou[0].payment_interest_type + "</td>" +
                    // 添加其他需要的列
                    "</tr>").appendTo("div[id='7']");

                $("<tr>" +
                    "<td>" + obj.vou[0].remark + "</td>" +
                    // 添加其他需要的列
                    "</tr>").appendTo("div[id='8']");
                //$("#doc-modal-list").text(obj.vou[0].remark);
                //
                //
                // $("<tr>" +
                //     "<td>" + "剩余pojo天" + "</td>" +
                //     // 添加其他需要的列
                //     "</tr>").appendTo("span[id='9']");

            });
            $("#back").on("click", function () {
                window.location.href = "my-ticket-list.jsp?eid=" + eid+"&name="+name;
            });
            $("#back1").on("click", function () {
                window.location.href = "my-ticket-list.jsp?eid=" + eid+"&name="+name;
            });
            $("#B").on("click", function () {
                window.location.href = "my-ticket-list.jsp?eid=" + eid+"&name="+name;
            });
            $("#input-name").blur(function () {
                val = $("#input-name").val();
                // alert(val);
                $("#doc-modal-list").empty();
                $.get("FMS/queryInstituties", {"no": no,"val":val}, function (voucher) {
                    eval("var obj=" + voucher);
                    var amount=obj.vou[0].amount;
                    if(val>amount){
                        alert("没那么多钱请重新输入");
                    }else {
                        let templat = "<tr class='jrjg_tr' jrjg-id='{{id}}' name='{{int}}'  data-id=\"2\">\n" +
                            "              <td>\n" +
                            "                  <label class=\"am-radio\">\n" +
                            "                      <input type=\"radio\" name=\"radio1\" value=\"\" data-am-ucheck\n" +
                            "                             checked>\n" +
                            "                  </label>\n" +
                            "              </td>\n" +
                            "              <td class=\"am-hide-sm-only\" style=\"line-height: 54px\">{{name}}</td>\n" +
                            "              <td class=\"am-hide-sm-only\">\n" +
                            "                  <div>预计到账</div>\n" +
                            "                  <div style=\"font-size: 20px;font-weight: bold;\">¥\n" +
                            "                      {{receipt_amount}}\n" +
                            "                  </div>\n" +
                            "              </td>\n" +
                            "              <td class=\"am-hide-sm-only\">\n" +
                            "                  <div id='intetest' name='{{Interest}}'>融资成本 （利率约 {{interest}}%）</div>\n" +
                            "                  <div style=\"font-size: 20px;font-weight: bold;\"> ¥ {{cost}}\n" +
                            "                  </div>\n" +
                            "              </td>\n" +
                            "              <td class=\"am-hide-sm-only\" style=\"line-height: 54px\">预计 {{receipt_day}} 天到账</td>\n" +
                            "          </tr>";
                        for (var i = 0; i < obj.selfin.length; i++) {
                            let selector_str = templat.replace("{{name}}", obj.selfin[i].name)
                                .replace("{{id}}", obj.selfin[i].name)
                                .replace("{{int}}", obj.selfin[i].interest)
                                .replace("{{receipt_amount}}", obj.selfin[i].receipt_amount)
                                .replace("{{interest}}", obj.selfin[i].interest * 100)
                                .replace("{{cost}}", obj.selfin[i].cost)
                                .replace("{{receipt_day}}", obj.selfin[i].receipt_day);
                            $(selector_str).appendTo($("#doc-modal-list"));
                        }
                        $(".jrjg_tr").click(function () {
                            bank = $(this).attr("jrjg-id");
                            num = $(this).attr("name");
                            // alert(bank+"..."+num);
                            $('#submitBtn').click( function () {
                                $('#baseinfoDiv').hide();
                                $('#showDiv').hide();
                                $('#institutionDiv').hide();
                                $('#resultDiv').show();
                                $.get("FMS/addTwoList", {"bank": bank, "num": num, "no": no,"val":val}, function (result) {
                                    eval("var res = "+result);
                                    if(res>0){
                                        window.location.href = "my-ticket-list.jsp?eid=" + eid+"&name="+name;
                                    }else{
                                        alert("提交失败");
                                    }
                                });
                            });
                        });
                    }
                });
            });

            // $('#submitBtn').on('click', function () {
            //     $('#baseinfoDiv').hide();
            //     $('#showDiv').hide();
            //     $('#institutionDiv').hide();
            //     $('#resultDiv').show();
            //     $.get("FMS/addTwoList", {"bank": bank, "num": num, "no": no,"val":val}, function (result) {
            //         eval("var res = "+result);
            //         if(result>0){
            //             window.location.href = "my-ticket-list.jsp?eid=" + eid+"&name="+name;
            //         }else{
            //             alert("提交失败");
            //         }
            //     });
            // });
            $("#btnTrans").click(function () {
                $.get("FMS/queryInstituties", {"no": no,"val":val}, function (voucher){
                    eval("var obj=" + voucher);
                    var amount=obj.vou[0].amount;
                    $('#input-name').val(amount);
                });
            });

        });
    </script>
    <style>
        .star::before {
            content: '*';
            color: #F56C6C;
            margin-right: 0.020833rem;
        }

        .am-selected {
            width: 100%
        }

        .am-selected-status {
            font-size: 13px;
            color: #999;
        }
    </style>
</head>
<body data-type="generalComponents">
<header class="am-topbar am-topbar-inverse admin-header">
    <div class="am-collapse am-topbar-collapse" id="topbar-collapse">
        <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list tpl-header-list">
            <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                    <span class="tpl-header-list-user-nick" id="name"> </span><span
                        class="tpl-header-list-user-ico"> <img
                        src="assets/img/user01.png"></span>
                </a>
                <ul class="am-dropdown-content">
                    <li><a href="login.jsp"><span class="am-icon-power-off"></span> 退出</a></li>
                </ul>
            </li>
        </ul>
    </div>
</header>
<div class="tpl-page-container tpl-page-header-fixed">
    <div class="tpl-left-nav tpl-left-nav-hover">
        <div class="tpl-left-nav-list">
            <ul class="tpl-left-nav-menu">
                <li class="tpl-left-nav-item">
                    <a href="javascript:;" class="nav-link tpl-left-nav-link-list active">
                        <i class="am-icon-table"></i>
                        <span>凭证管理</span>
                        <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right tpl-left-nav-more-ico-rotate"></i>
                    </a>
                    <ul class="tpl-left-nav-sub-menu" style="display:block">
                        <li>
                            <a href="finance-list.jsp">
                                <i class="am-icon-angle-right"></i>
                                <span>融资列表</span>
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="tpl-left-nav-item">
                    <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
                        <i class="am-icon-wpforms"></i>
                        <span>我的凭证</span>
                        <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>
                    </a>
                    <ul class="tpl-left-nav-sub-menu">
                        <li>
                            <a id="B">
                                <i class="am-icon-angle-right"></i>
                                <span>我的凭证列表</span>
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <div class="tpl-content-wrapper">
        <div class="tpl-content-page-title">
            凭证融资
        </div>
        <ol class="am-breadcrumb">
            <li class="am-active"><a style="color: #999999;">凭证管理</a></li>
            <li class="am-active">凭证融资</li>
        </ol>
        <!-- 基本信息 -->
        <div class="tpl-portlet-components" id="baseinfoDiv">
            <div class="portlet-title">
                <div class="caption font-green bold">
                    凭证基本信息
                </div>
                <div class="tpl-portlet-input tpl-fz-ml">
                    <div class="portlet-input input-small input-inline">
                        <div class="input-icon right">
                        </div>
                    </div>
                </div>
            </div>
            <div class="tpl-block ">
                <div class="am-g tpl-amazeui-form">
                    <div class="am-u-sm-12 am-u-md-6">
                        <form class="am-form am-form-horizontal">
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">开单企业</label>
                                <div   class="am-u-sm-9" title="1" style="margin-top: 4px;font-size: 16px;" id="1">

                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6">
                        <form class="am-form am-form-horizontal">
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">统一社会信用代码</label>
                                <div class="am-u-sm-9" title="1" style="margin-top: 4px;font-size: 16px;" id="2">

                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6">
                        <form class="am-form am-form-horizontal">
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">金融机构</label>
                                <div class="am-u-sm-9" title="1" style="margin-top: 4px;font-size: 16px;" id="3">

                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6">
                        <form class="am-form am-form-horizontal">
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">凭证金额</label>

                                <div class="am-u-sm-9" title="1" style="font-size: 19px;color: red;font-weight: 500;" id="4">

                                </div>

                            </div>
                        </form>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6">
                        <form class="am-form am-form-horizontal">
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">开单日期</label>
                                <div class="am-u-sm-9" title="1" style="margin-top: 4px;font-size: 16px;" id="5">

                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6">
                        <form class="am-form am-form-horizontal">
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">到期日期</label>
                                <div class="am-u-sm-9" title="1" style="margin-top: 4px;font-size: 16px;" id="6">
                                    <span style="font-size: 12px;color: #999" id="9"> </span>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6">
                        <form class="am-form am-form-horizontal">
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">付息方式</label>
                                <div class="am-u-sm-9"  title="1" style="margin-top: 4px;font-size: 16px;" id="7">

                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6">
                        <form class="am-form am-form-horizontal">
                            <div class="am-form-group">
                                <label for="user-name" class="am-u-sm-3 am-form-label">备注</label>
                                <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;" id="8">
                                    无
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="am-u-sm-12 am-u-md-6">
                    </div>
                </div>
            </div>
        </div>
        <div class="tpl-portlet-components" id="showDiv">
            <!-- 表单填写页面 -->
            <div class="tpl-block">
                <div class="">
                    <div class="portlet-title">
                        <div class="caption font-green bold">
                            融资业务信息
                        </div>
                        <div class="tpl-portlet-input tpl-fz-ml">
                            <div class="portlet-input input-small input-inline">
                                <div class="input-icon right">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tpl-block ">
                        <div class="am-g tpl-amazeui-form">
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label star"> 融资金额</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                            <input value="" type="text" id="input-name" placeholder="请输入凭证金额">
                                            <span id="btnTrans"
                                                  style="color:#3bb4f2;font-size:12px;cursor: pointer;">全部融资</span>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label">剩余凭证金额</label>
                                        <div class="am-u-sm-9" title="1" style="margin-top: 4px;font-size: 16px;" id="4">

                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                        <div class="am-g tpl-amazeui-form">
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label">备注</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                                <textarea class="" rows="4" id="user-intro"
                                                          placeholder="请输入备注"></textarea>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="tpl-portlet-components">
            <!-- 金融机构信息 -->
            <div class="tpl-block" id="institutionDiv">
                <div class="">
                    <div class="portlet-title">
                        <div class="caption font-green bold">
                            金融机构信息
                        </div>
                        <div class="tpl-portlet-input tpl-fz-ml">
                            <div class="portlet-input input-small input-inline">

                                <div class="input-icon right">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tpl-block ">
                        <div class="am-g">
                            <div class="am-u-sm-12">
                                <form class="am-form">
                                    <table class="am-table am-table-striped am-table-hover table-main">
                                        <tbody id="doc-modal-list"></tbody>
                                    </table>

                                    <hr>

                                </form>
                            </div>
                        </div>
                        <div style="text-align: center;margin-top:40px">
                            <a class="am-btn am-btn-default" id="back">取&nbsp;&nbsp;&nbsp;&nbsp;
                                消</a>
                            <a id="submitBtn" class="am-btn am-btn-primary"
                               style="margin-left:20px">提&nbsp;&nbsp;&nbsp;&nbsp; 交</a>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 提交成功页面 -->
            <div class="tpl-block " id="resultDiv" hidden>
                <div class="am-g tpl-amazeui-form">
                    <div class="am-u-sm-12 am-u-md-12">
                        <form class="am-form am-form-horizontal">
                            <div class="am-form-group">
                                <div class="am-u-sm-12"
                                     style="margin-top: 4px;text-align: center;margin-bottom: 20px;">
                                    <img src="assets/img/u105.png" alt="" style="width: 120px;">
                                </div>
                                <div class="am-u-sm-12"
                                     style="margin-top: 4px;font-size: 20px;text-align: center;font-weight: bold;margin-bottom: 20px;">
                                    提交申请成功
                                </div>
                                <div class="am-u-sm-12" style="color: #999;font-size:14px;text-align: center;">
                                    已通知审核人员尽快审核，最终结果将以站内信的方式告知您。
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div style="text-align: center;margin-top:40px">
                    <a class="am-btn am-btn-primary" id="back1">返回列表</a>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="assets/js/jquery.min.js">
</script>
<script src="assets/js/amazeui.min.js"></script>
<script src="assets/js/app.js"></script>
</body>

</html>